'use strict';

const Controller = require('egg').Controller;
const checkUserAgent = require('../util/checkUserAgent')

class HomeController extends Controller {
    async index() {
        const { ctx } = this;
        const ua = checkUserAgent(ctx.header['user-agent'])
        const data = await ctx.service.website.getHomePageData()
        if (ua) {
            await ctx.render("pc/home.html", data)
        } else {
            await ctx.render("mobile/home.html",data)
        }
    }
}

module.exports = HomeController;